
public class Test {
    public static void main(String[] args) {

    }
}



/* public class TreeNode {
      int val;
      TreeNode left;
      TreeNode right;
      TreeNode() {}
      TreeNode(int val) { this.val = val; }
     TreeNode(int val, TreeNode left, TreeNode right) {
          this.val = val;
         this.left = left;
         this.right = right;
     }
 }*/
 //最大深度
/* class Solution {
     public int maxDepth(TreeNode root) {
         if(root == null) {
             return 0;
         }
         int leftdepth = maxDepth(root.left);
         int rightdepth = maxDepth(root.right);

         return leftdepth>rightdepth ? leftdepth+1 : rightdepth+1;
     }
 }*/
//平衡二叉树
/* class Solution {
     public boolean isBalanced(TreeNode root) {
        if (root == null){
            return true;
        }
        int left =maxDepth(root.left);
        int right =maxDepth(root.right);

        return Math.abs(left - right)<=1 && isBalanced(root.left) && isBalanced(root.right);
     }
     public int maxDepth(TreeNode root) {
         if(root == null) {
             return 0;
         }
         int leftdepth = maxDepth(root.left);
         int rightdepth = maxDepth(root.right);

         return leftdepth>rightdepth ? leftdepth+1 : rightdepth+1;
     }
 }*/
/* class Solution {
     public boolean isBalanced(TreeNode root) {
         if (root == null){
             return true;
         }
         return  maxDepth(root)>=0;
     }
     public int maxDepth(TreeNode root) {
         if(root == null) {
             return 0;
         }
         int left = maxDepth(root.left);
         if (left < 0 ) {
             return -1;
         }
         int right = maxDepth(root.right);
         if (left >=0 && right >= 0 && Math.abs(left - right)<=1 ) {
             return Math.max(left,right)+1;
         }else {
            return -1;
         }
     }
 }*/
 //相同的树
/*
class Solution {
    public boolean isSameTree(TreeNode p, TreeNode q) {
        if ((p == null && q != null) || (p != null && q == null) ) {
            return false;
        }
        if (p == null && q == null) {
            return true;
        }
        if (p.val != q.val) {
            return false;
        }
        return isSameTree(p.left,q.left) && isSameTree(p.right,q.right);

    }
}*/
//另一棵树的子树
/*
class Solution {
    public boolean isSubtree(TreeNode root, TreeNode subRoot) {
        if (root == null) {
            return false;
        }
        if(isSameTree(root,subRoot)) {
            return true;
        }
        if (isSubtree(root.left,subRoot)) {
            return  true;
        }
        if (isSubtree(root.right,subRoot)) {
            return  true;
        }
        return  false;
    }
    public boolean isSameTree(TreeNode p, TreeNode q) {
        if ((p == null && q != null) || (p != null && q == null) ) {
            return false;
        }
        if (p == null && q == null) {
            return true;
        }
        if (p.val != q.val) {
            return false;
        }
        return isSameTree(p.left,q.left) && isSameTree(p.right,q.right);

    }
}
*/
//翻转二叉树
/* class Solution {
     public TreeNode invertTree(TreeNode root) {
        if (root == null){
            return null;
        }
         if (root.left == null && root.right == null) {
             return root;
         }
        TreeNode tep = root.left;
        root.left = root.right;
        root.right = tep;

        invertTree(root.left);
        invertTree(root.right);
        return root;
     }
 }*/
//对称二叉树
/*
class Solution {
    public boolean isSymmetric(TreeNode root) {
        if (root == null) {
            return true;
        }

        return leftright(root.left,root.right);
    }
    private boolean leftright(TreeNode left,TreeNode right){
        if ((left !=null) && (right == null) ||(left ==null) &&(right != null)){
            return false;
        }
        if (left == null && right==null) {
            return true;
        }
        if (left.val != right.val){
            return false;
        }

        return leftright(left.left,right.right) && leftright(left.right,right.left);
    }
}
*/
